<div class="section"> 
  <script type="text/javascript">
	$(document).ready(function(){
		$("#okie").click(function(){
			if($("#title").val() == ""){$("#title").focus(); return false;}
			if($("#cateid").val() == 0){alert("Please select a category"); return false;}
		})
		$("#cateid").change(function(){
			$id = $(this).val();
			jQuery.post("<?php echo base_url(); ?>admin/questions/getcago",{id:$id},function(result){
				$("#recagoid").html(result);
			});
		});
	});
  </script> 
  <!--[if !IE]>start title wrapper<![endif]-->
  <div class="title_wrapper"> <span class="title_wrapper_top"></span>
    <div class="title_wrapper_inner"> <span class="title_wrapper_middle"></span>
      <div class="title_wrapper_content">
        <h2 class="menu_title">Add new question</h2>
      </div>
    </div>
    <span class="title_wrapper_bottom"></span> </div>
  <!--[if !IE]>end title wrapper<![endif]--> 
  
  <!--[if !IE]>start section content<![endif]-->
  <div class="section_content"> <span class="section_content_top"></span>
    <div class="section_content_inner">
      <div class="table_tabs_menu"> 
        <!--[if !IE]>start  tabs<![endif]--> 
        <!--[if !IE]>end  tabs<![endif]--> 
        
      </div>
      <!--[if !IE]>start table_wrapper<![endif]-->
      <div class="table_wrapper" style="background:none;">
        <div class="table_wrapper_inner">
          <div class="error_red">
            <?php if(isset($error)) { echo "<p>".$error."</p>"; } ?>
            <?php echo validation_errors();?> </div>
          <form action="<?php echo base_url();?>admin/questions/update/<?php echo $result['id']; ?>" method="post" name="sac" onsubmit="return check()" enctype="multipart/form-data">
            <div class="form_items">
              <div class="form_items_left">Title</div>
              <div class="form_items_right">
                <input name="title" id="title" value="<?php echo $result['title']; ?>" type="text" size="35" />
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">User id</div>
              <div class="form_items_right">
                <input name="userid" type="text" value="<?php echo $result['userid']; ?>" size="35" />
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">User name</div>
              <div class="form_items_right">
                <input name="username" type="text" value="<?php echo $result['username']; ?>" size="35" />
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">Keywords</div>
              <div class="form_items_right">
                <textarea name="keywords" cols="30" rows="5"><?php echo $result['keywords']; ?></textarea>
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">Description</div>
              <div class="form_items_right">
                <textarea name="description" cols="30" rows="5"><?php echo $result['description']; ?></textarea>
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">Select category</div>
              <div class="form_items_right">
                <table width="249" border="0">
                  <tr>
                    <td width="115" style="padding:0px;background:none;border:none"><select name="cateid" id="cateid">
                        <option value="0">Select category</option>
                        <?php if(isset($listcate)){ foreach($listcate as $items){ ?>
                        <option value="<?php echo $items['cid']; ?>"><?php echo $items['names']; ?></option>
                        <?php } } ?>
                      </select></td>
                    <td width="124" style="padding:0px;background:none;border:none" id="recagoid"><select name="cagoid">
                        <option value="">Select sub</option>
                      </select></td>
                  </tr>
                </table>
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">Views</div>
              <div class="form_items_right">
                <input name="views" type="text" value="<?php echo $result['views']; ?>" size="35" />
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">Likes</div>
              <div class="form_items_right">
                <input name="likes" type="text" value="<?php echo $result['likes']; ?>" size="35" />
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">Dislike</div>
              <div class="form_items_right">
                <input name="dislike" type="text" value="<?php echo $result['dislike']; ?>" size="35" />
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">Type your question</div>
              <div class="form_items_right">
                <?php 
				$fck = new FCKeditor('info');
				$fck->BasePath = sBASEPATH;
				$fck->Value  = $result['info'];					
				$fck->Width  = '100%';
				$fck->Height = 400;
				$fck->Create();
			    ?>
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">Image of question</div>
              <div class="form_items_right">
                <input type="file" name="image" size="25" />
              </div>
            </div>
            <div class="form_items">
              <div class="form_items_left">&nbsp;</div>
              <div class="form_items_right">
                <input type="submit" name="okie" id="okie" value="Edit now" class="magin"/>
                <input type="reset" name="Reset" id="button" value="Reset" class="magin"/>
              </div>
            </div>
          </form>
        </div>
      </div>
      <!--[if !IE]>end table_wrapper<![endif]--> 
    </div>
    <span class="section_content_bottom"></span> </div>
  <!--[if !IE]>end section content<![endif]--> 
</div>
